<?php
if (isset($_POST['captcha']))
{
    session_start();
    
    $prototype = $_SESSION['captcha'];
    $captcha   = strtolower(trim($_POST['captcha']));
    
    if (preg_match('/[a-z\d]+/', $captcha))
    {
        if ($prototype == $captcha)
        {
            echo '您输入的验证码是正确的：'.$prototype;
        }
        else
        {
            echo '您输入的验证码是错误的';
        }
    }
    else
    {
        echo '您输入的验证码不符合格式';
    }
}
else
{
    echo '非法操作';
}
